const fpath = require("path");

// path.join()    路径拼接
const newPath = fpath.join(__dirname, "/a", "/b/c", "../", "/d"); //  \a\b\d
console.log(newPath);

//path.basename()   文件名的获取
const oldPath = "a/b/c/index.html";
const newName = fpath.basename(oldPath);
console.log(newName); //  index.html
const newName2 = fpath.basename(newName, ".html");
console.log(newName2); //  index

//path.extname()    文件拓展名的获取
const oldPath2 = "a/b/c/index.txt";
const newName3 = fpath.extname(oldPath2);
console.log(newName3);
